class Solution(object):
    def isAnagram(self, s, t):
        """
        :type s: str
        :type t: str
        :rtype: bool
        """
        if len(s) != len(t):
            return False

        charCnt = [0] * 26

        for i in range(len(s)):
            charCnt[ord(s[i]) - 97] += 1
            charCnt[ord(t[i]) - 97] -= 1

        for cnt in charCnt:
            if cnt != 0:
                return False
        return True



class Solution(object):
    def isAnagram(self, s, t):
        """
        :type s: str
        :type t: str
        :rtype: bool
        """
        if len(s) != len(t):
            return False
        count = dict()
        for i in range(len(s)):
            if s[i] in count:
                count[s[i]] += 1
            else:
                count[s[i]] = 1
        for i in range(len(t)):
            if t[i] in count:
                count[t[i]] -= 1
            else:
                return False
        for key, value in count.items():
            if value != 0:
                return False
        return True
    
            